home *** CD-ROM | disk | FTP | other *** search
/ Ray Dream Studio 5 / Ray Dream.iso / pc / DreamSDK / Windows / SAMPLES / SHADER / SHDR / COMSHDR.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-11  |  2.4 KB  |  92 lines

  1. // Copyright (c)1995 Ray Dream, Inc. All Rights Reserved.
  2. /* $Id: COMShdr.cpp 1.1 1996/07/19 00:15:20 Damien Exp $ */
  3.  
  4. // Shader COM Object 
  5.  
  6. #ifndef __COMSHDR__
  7. #include "COMShdr.H"
  8. #endif
  9.  
  10. #ifndef __3DCOFAIL__
  11. #include "3DCoFail.h"
  12. #endif
  13.  
  14. #undef INTERFACE
  15. #define INTERFACE COMShader
  16. COMShader::COMShader() {
  17.   fcRef=0;  // No reference used, so 0 in the Reference counter
  18.   }
  19.   
  20. COMShader::~COMShader() {
  21.   }
  22.   
  23. // IUnknown methods of COMShader :
  24. HRESULT COMShader::QueryInterface(THIS_ REFIID riid, LPVOID* ppvObj) {
  25.   *ppvObj=NULL;
  26.   
  27.   // The COMShader knows the interfaces of the parent Objects
  28.   if (IsEqualIID(riid, IID_IUnknown))
  29.     *ppvObj=(LPVOID)this;
  30.   else if (IsEqualIID(riid, IID_I3DExShader))
  31.     *ppvObj=(LPVOID)this;
  32.   else if (IsEqualIID(riid, IID_I3DExDataExchanger))
  33.     *ppvObj=(LPVOID)this;
  34.   else if (IsEqualIID(riid, IID_I3DExtension))
  35.     *ppvObj=(LPVOID)this;
  36.     
  37.   // we must add reference if we return an interface
  38.   if (*ppvObj!=NULL) {
  39.     ((LPUNKNOWN)*ppvObj)->AddRef();
  40.     return NOERROR;
  41.     }
  42.   else {
  43.     return ResultFromScode(E_NOINTERFACE);
  44.     }
  45.   }
  46.                         
  47. // Add a reference to know how much pointer are initialised on this object                        
  48. ULONG COMShader::AddRef(THIS) {
  49.   return ++fcRef;
  50.   }
  51.   
  52. ULONG COMShader::Release(THIS) {
  53.   ULONG UnreleaseRef;    // Number of unrelease reference
  54.   
  55.   UnreleaseRef= --fcRef;
  56.   if (fcRef==0) {
  57.      delete this;   // No reference left so delete this COMShader
  58.      }
  59.   return UnreleaseRef;
  60.   }
  61.  
  62. HRESULT COMShader::ShellUtilitiesInit(THIS_ IShUtilities* shellUtilities) {
  63.   InitCoFailure(shellUtilities);
  64.   return NOERROR;
  65.   }  
  66.  
  67.   
  68. // Called when the Shell modified the Properties Datas  
  69. HRESULT COMShader::ExtensionDataChanged(THIS) {
  70.   fPreprocessed=FALSE;
  71.   return NOERROR;
  72.   }
  73.  
  74. // Special function when you create a special resource file/item  
  75. HRESULT COMShader::HandleEvent(THIS_ ULONG sourceID) {
  76.   return ResultFromScode(E_NOTIMPL);
  77.   }
  78.   
  79. HRESULT COMShader::DoShade(THIS_ ShadingInOut* theShadingIO, ShadingElem* theShadingElem) {
  80.   return ResultFromScode(E_NOTIMPL);
  81.   } 
  82.                   
  83. // Did the COMShader depends on the UV Space
  84. BOOLEAN COMShader::DependsOnAppliedExtent(THIS) {
  85.   return FALSE;
  86.   }
  87.  
  88. void COMShader::CopyData(COMShader* dest) {
  89.   dest->fPreprocessed = fPreprocessed;     // Copy data to make a clone
  90.   }
  91.  
  92.